package com.Stash.Service.impl;

import com.Stash.Dao.GeneralDao;
import com.Stash.Domain.*;
import com.Stash.Service.GeneralService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Date;
import java.util.List;

@Service
public class GeneralServiceImpl implements GeneralService {
    @Autowired // 自动装配其他bean
    private GeneralDao General;

    @Override
    public admins AdminLogin(admins admin) {
        admins admins = General.AdminLogin(admin);
        return admins;
    }

    @Override
    public void AdminPassword(admins admin) {
        General.AdminPassword(admin);
    }

    @Override
    public List<Classification> ClassificationSelectAll() {
        List<Classification> classifications = General.ClassificationSelectAll();
        return classifications;
    }

    @Override
    @Transactional(value = "Storage")
    public void StorageAdd(Storage storage) {
        General.StorageAdd(storage);
    }

    @Override
    @Transactional(value = "Storage")
    public void ProductAdd(Product product) {
        General.ProductAdd(product);
    }

    @Override
    public Product ProductSelectName(String productName, Integer productClassificationId, Float productSpecification) {
        Product stash1 = General.ProductSelectName(productName,productClassificationId,productSpecification);
        return stash1;
    }

    @Override
    @Transactional(value = "Storage")
    public void productUpdateInformation(Product product) {
        General.productUpdateInformation(product);
    }

    @Override
    public Stash StashId(Integer stashId) {
        Stash stash1 = General.StashId(stashId);
        return stash1;
    }

    @Override
    public Classification classificationSelectId(Integer classificationId) {
        Classification classification = General.classificationSelectId(classificationId);
        return classification;
    }

    @Override
    @Transactional(value = "Storage")
    public void StashUpdateCapacity(Stash stash) {
        General.StashUpdateCapacity(stash);
    }

    @Override
    public List<Product> ProductSelect() {
        List<Product> products = General.ProductSelect();
        return products;
    }

    @Override
    public List<Product> ProductSelectLimit(Page page) {
        List<Product> products = General.ProductSelectLimit(page);
        return products;
    }

    @Override
    public List<Stash> StashSelectList(String[] List) {
        List<Stash> stashes = General.StashSelectList(List);
        return stashes;
    }

    @Override
    public Product ProductSelectId(Product product) {
        Product product1 = General.ProductSelectId(product);
        return product1;
    }

    @Override
    @Transactional(value = "Storage")
    public void NumberAdd(NumberFn numberFn) {
        General.NumberAdd(numberFn);
    }

    @Override
    public NumberFn NumberSelectAll(NumberFn numberFn) {
        NumberFn numberFn1 = General.NumberSelectAll(numberFn);
        return numberFn1;
    }

    @Override
    @Transactional(value = "Storage")
    public void NumberUpdateNumber(NumberFn numberFn) {
        General.NumberUpdateNumber(numberFn);
    }

    @Override
    public void productUpdateClassification(Product product) {
        General.productUpdateClassification(product);
    }

    @Override
    public List<Storage> StorageSelectAll(Integer storageProductId) {
        List<Storage> storages = General.StorageSelectAll(storageProductId);
        return storages;
    }

    @Override
    public List<Storage> StorageSelectId(Integer storageProductId, Integer storageState) {
        List<Storage> storages = General.StorageSelectId(storageProductId,storageState);
        return storages;
    }

    @Override
    public Storage StorageSelect(Integer storageId) {
        Storage storages = General.StorageSelect(storageId);
        return storages;
    }

    @Override
    public List<StashNumberFnProduct> StashNumberFnProductAll(Integer stashId) {
        List<StashNumberFnProduct> stashNumberFnProducts = General.StashNumberFnProductAll(stashId);
        return stashNumberFnProducts;
    }

    @Override
    public List<StashNumberFnProduct> StashNumberFnProductClassAll(Integer stashId) {
        List<StashNumberFnProduct> stashNumberFnProducts = General.StashNumberFnProductClassAll(stashId);
        return stashNumberFnProducts;
    }

    @Override
    public List<Storage> StorageSelectTime(Date TimeStart, Date TimeEnd, Integer storageStashId) {
        List<Storage> storages = General.StorageSelectTime(TimeStart,TimeEnd,storageStashId);
        return storages;
    }

    @Override
    @Transactional(value = "Storage")
    public void DeleteProduct(Product product) {
        General.DeleteProduct(product);
    }
}
